package com.yuchengtech.test.pack.action;

import java.io.File;

import com.wox.action.JsonData;
import com.wox.action.WoxAction;

public class EditFileAction extends WoxAction {

	String filePath;
	
	
	public String getFilePath() {
		return filePath;
	}


	public void setFilePath(String filePath) {
		this.filePath = filePath;
	}


	
	@Override
	public String excute() throws Exception {
		 JsonData data=getJsonData();
		 File file=new File(filePath);
		 if(!file.exists())
			 file.createNewFile();
			 if(file.isFile())
			 {
			  Runtime.getRuntime().exec("notepad.exe " + filePath);
			  data.setState(true);
			  data.setMessage("文件已打开");
			 }else
			 {
				 data.setMessage("文件为文件夹");
			 }
		 
		return JSONBACK;
	}

}
